// Graph.h
// Graph representation, loading and preprocessing

#pragma once

#include "DataTypes.h"
#include <string>
#include <vector>

class Graph {
public:
    // Load nodes and edges data from CSV files
    bool load_from_csv(const std::string& nodes_csv_path, const std::string& edges_csv_path, CodeMap& code_map);

    // Get number of nodes
    int get_num_nodes() const;

    // Get specific node data (ID is 1-based)
    const NodeData& get_node_data(int node_id) const;

    // Get successor nodes list for specific node (direct children)
    const std::vector<int>& get_successors(int node_id) const;

    // Get predecessor nodes list for specific node (direct parents)
    const std::vector<int>& get_predecessors(int node_id) const;

    // Get indegrees for all nodes
    std::vector<int> get_indegrees() const;

private:
    std::vector<NodeData> nodes_; // Store node information, index 0 corresponds to ID 1
    std::vector<std::vector<int>> adj_list_; // Adjacency list (successor/child nodes list)
    std::vector<std::vector<int>> predecessors_list_; // Predecessor/parent nodes list
};